var Information = function(companyName, description, address, email, phone){
    this.CompanyName = companyName;
    this.Description = description;
    this.Address = address;
    this.Email = email;
    this.Phone = phone;
}

function createAbout(information){
    var about = null;
    about = new Information(information.getElementsByTagName("CompanyName")[0].childNodes[0].nodeValue,information.getElementsByTagName("Description")[0].childNodes[0].nodeValue,information.getElementsByTagName("Address")[0].childNodes[0].nodeValue,information.getElementsByTagName("Email")[0].childNodes[0].nodeValue,information.getElementsByTagName("Phone")[0].childNodes[0].nodeValue);
    return about;
}

function createAboutNodes(information){
    var key = "about";
    addActive(key);
    var rootNode = $id("content");
    var companyName = null;
    var description = null;
    var address = null;
    var email = null;
    var phone = null;
    var inf = information;

    rootNode.innerHTML="";

    companyName = createNode("p")
    companyName.setText(inf.CompanyName);

    address = createNode("p")
    address.setText(inf.Address);

    email = createNode("p")
    email.setText("Email: " +inf.Email);

    phone = createNode("p")
    phone.setText("Phone:" +inf.Phone);

    description = createNode("p")
    description.setText(inf.Description);

    rootNode.appendChild(companyName);
    rootNode.appendChild(address);
    rootNode.appendChild(description);
    rootNode.appendChild(phone);
    rootNode.appendChild(email);
}

function callServiceInformation(){
    ajax.get({
        url:"http://localhost:8080/book-service/public/info",

        success: function(data){
           var info = createAbout(data);
           createAboutNodes(info)
        },
        failure: function(){
            console.log("fail callServiceInfromation");
        }
    })
}